package com.yiqi.liebang.feature.setting.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.liebang.entity.bo.EditPrivacyBo;
import com.yiqi.liebang.entity.bo.PrivacyBo;
import com.yiqi.liebang.entity.bo.UserCenterBo;
import com.yiqi.liebang.feature.mine.contract.UserContract;
import com.yiqi.liebang.feature.mine.dependencies.login.DaggerUserModelComponent;
import com.yiqi.liebang.feature.setting.contract.PrivacyContract;
import com.yiqi.liebang.feature.setting.dependencies.login.DaggerPrivacyModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.UserApi;

import javax.inject.Inject;

import io.reactivex.Observable;

public class PrivacyModel implements PrivacyContract.Model {

    @Inject
    UserApi api;


    @Inject
    public PrivacyModel() {
        DaggerPrivacyModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<PrivacyBo> getPrivacyData() {
        return api.getPrivacyList().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> editPrivacy(EditPrivacyBo privacyBo) {
        return api.editPrivacy(privacyBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
